<?php
class Gtux_Forms_Setup_FormularioGuardar extends Zend_Dojo_Form
{
  /**
   * 
   */
  public function init ()
  {
    $this->setAction('/setup/formularios')
         ->setMethod('post')
         ->setAttrib('id', 'frmGuardarFormulario');
    
    $this->setDecorators(array(
        'FormElements',
        array('HtmlTag', array('tag' => 'table')),
        'DijitForm'
    ));
    
    $elements = new ArrayObject();
        
    // paso
    $element = new Zend_Form_Element_Hidden('paso');
    $element->setAttrib('id', 'hdnPaso')
            ->setValue('6')
            ->addValidator(new Zend_Validate_Int());
    $elements[] = $element;            
    
    // creo el hash contra CSRF
    $nocsrf = new Zend_Form_Element_Hash('token');
    $nocsrf->setSalt(get_class($this).Zend_Registry::get('salt'));
    $nocsrf->setTimeout(3600);
    $elements[] = $nocsrf;
    
    // creo el boton de submit
    $submit = new Zend_Dojo_Form_Element_SubmitButton('Guardar');
    $submit->setAttrib('id', 'smbGuardar')
           ->setOrder(1);   
    $elements[] = $submit;               
    
    foreach ($elements as $item) 
    {
      $item->setDecorators(array(
             'DijitElement',
             array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td', 'colspan' => 2, 'style' => 'text-align: center;')),
             array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))
           ));
      $this->addElement($item);
    }
  }
  
}
?>